#include "Camera.h"
#include "dConfig.h"

namespace LTGame
{

	Camera::Camera()
	{
		setSize(CAMERA_W,CAMERA_H);
	}

	Camera::~Camera()
	{

	}

	void Camera::update(void)
	{
		cam_LT_y += cam_vy;
		cam_RB_y += cam_vy;
	}
	void Camera::addCameraLeft(int num)
	{
		cam_LT_x += num;
	}
	void Camera::addCameraTop(int num)
	{
		cam_LT_y += num;
	}
	void Camera::addCameraRight(int num)
	{
		cam_RB_x += num;
	}
	void Camera::addCameraBottom(int num)
	{
		cam_RB_y += num;
	}
	void Camera::setPosition(float center_x, float center_y)
	{
		cam_LT_x = /*center_x - cam_w_w*/0;
		cam_LT_y = center_y - cam_h_h;
		cam_RB_x = /*center_x + cam_w_w*/CAMERA_W;
		cam_RB_y = center_y + cam_h_h;
		//cam_LT_x = center_x - cam_w_w;
		//cam_LT_y = center_y - cam_h_h;
		//cam_RB_x = center_x + cam_w_w;
		//cam_RB_y = center_y + cam_h_h;
	}

	void Camera::setSize(float w, float h)
	{
		cam_width = w;
		cam_height = h;
		cam_w_w = (w + 1)/2;
		cam_h_h = (h + 1)/2;
	}
}